package com.catmiw.stock.domain.middle;

import java.util.Date;

public class PESimulateResult {
	public void simulate(){
		if (pe<9.0){
			double sum=this.accountDeposit+this.investMoney+this.indexFund*this.stockFund;
			this.buyStock=sum/this.indexStock;
			this.investStock=sum;
			this.accountDeposit=0;
			this.saleFund=this.stockFund;
			this.stockFund=0;
			this.stockStock+=buyStock;
		} else if (pe>=9.0&&pe<14){
			double sum=this.investMoney;
			this.investStock=sum;
			this.buyStock=sum/this.indexStock;
			this.stockStock+=buyStock;
		} else if (pe>=14.0&&pe<19){
			double sum=this.investMoney;
			this.investStock=sum/2.0;
			this.investFund=sum/2.0;
			this.buyStock=investStock/this.indexStock;
			this.buyFund=investFund/this.indexFund;
			this.stockStock+=buyStock;
			this.stockFund+=buyFund;
		} else if (pe>=19.0&&pe<24){
			//double sum=this.investMoney;
			//this.investDeposit=sum;
			//this.accountDeposit+=sum;
			double sum=this.investMoney;
			this.investFund=sum;
			this.buyFund=sum/indexFund;
			this.stockFund+=buyFund;
		}  else if (pe>=24.0&&pe<31){
			double sum=this.investMoney;
			this.investDeposit=sum;
			this.accountDeposit+=sum;
		} else if (pe>=31&&pe<33){
			double sum=this.investMoney;
			this.accountDeposit+=(sum+this.indexStock*this.stockStock);
			this.saleStock=this.stockStock;
			this.stockStock=0;
			this.investDeposit=sum;
		} else {
			double sum=this.investMoney;
			this.accountDeposit+=(sum+this.indexFund*this.stockFund+this.indexStock*this.stockStock);
			this.saleFund=this.stockFund;
			this.saleStock=this.stockStock;
			this.stockFund=0;
			this.stockStock=0;
			this.investDeposit=sum;
		}
		
		this.totalAssets=this.accountDeposit+this.stockFund*this.indexFund+this.stockStock*this.indexStock;
	}
	
	private Date date;
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public double getPe() {
		return pe;
	}
	public void setPe(double pe) {
		this.pe = pe;
	}
	public double getIndexStock() {
		return indexStock;
	}
	public void setIndexStock(double indexStock) {
		this.indexStock = indexStock;
	}
	public double getIndexFund() {
		return indexFund;
	}
	public void setIndexFund(double indexFund) {
		this.indexFund = indexFund;
	}
	public double getInvestMoney() {
		return investMoney;
	}
	public void setInvestMoney(double investMoney) {
		this.investMoney = investMoney;
	}
	public double getInvestStock() {
		return investStock;
	}
	public void setInvestStock(double investStock) {
		this.investStock = investStock;
	}
	public double getInvestFund() {
		return investFund;
	}
	public void setInvestFund(double investFund) {
		this.investFund = investFund;
	}
	public double getInvestDeposit() {
		return investDeposit;
	}
	public void setInvestDeposit(double investDeposit) {
		this.investDeposit = investDeposit;
	}
	public double getBuyStock() {
		return buyStock;
	}
	public void setBuyStock(double buyStock) {
		this.buyStock = buyStock;
	}
	public double getBuyFund() {
		return buyFund;
	}
	public void setBuyFund(double buyFund) {
		this.buyFund = buyFund;
	}
	public double getSaleStock() {
		return saleStock;
	}
	public void setSaleStock(double saleStock) {
		this.saleStock = saleStock;
	}
	public double getSaleFund() {
		return saleFund;
	}
	public void setSaleFund(double saleFund) {
		this.saleFund = saleFund;
	}
	public double getStockStock() {
		return stockStock;
	}
	public void setStockStock(double stockStock) {
		this.stockStock = stockStock;
	}
	public double getStockFund() {
		return stockFund;
	}
	public void setStockFund(double stockFund) {
		this.stockFund = stockFund;
	}
	public double getAccountDeposit() {
		return accountDeposit;
	}
	public void setAccountDeposit(double accountDeposit) {
		this.accountDeposit = accountDeposit;
	}
	public double getTotalAssets() {
		return totalAssets;
	}
	public void setTotalAssets(double totalAssets) {
		this.totalAssets = totalAssets;
	}
	private double pe;
	private double indexStock;
	private double indexFund;
	private double investMoney;
	private double investStock;
	private double investFund;
	private double investDeposit;
	private double buyStock;
	private double buyFund;
	private double saleStock;
	private double saleFund;
	private double stockStock;
	private double stockFund;
	private double accountDeposit;
	private double totalAssets;
}
